package com.hzxy.yiyid.web.module.utils.picture;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 * @ClassName WebMvcConfigurer
 * @Description TOOD
 * @Author RAICOM2023
 * @Date 2023/5/1 13:57
 * @Version 1.0
 **/
@Configuration
public class WebMvcConfigurer extends WebMvcConfigurerAdapter {

    private String picturePath;

    @Value("${pic.path}")
    public void setAppId(String str) {
        picturePath = str;
    }

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        //和页面有关的静态目录都放在项目的static目录下
        registry.addResourceHandler("/pic/**").addResourceLocations("file:"+picturePath);
    }

}